]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/Actors/StandardShip.cs
Stuffffffff
[rbdr/super-polarity] / Super Polarity / Actors / StandardShip.cs
index 50a671ad6196f9254aea6d6b9a632138a5def5ac..ef2fe7f8116c008c17e4c209d34670373d72f0fd 100644 (file)
@@ -12,15 +12,16 @@ namespace SuperPolarity
     class StandardShip : Ship
     {
 
+        protected bool Flashing;
         protected int ChangeRate;
         protected int CurrentTime;
-        protected int AngleChangeProbability;
+        public int AngleChangeProbability;
         protected int BouncePadding;
         protected float RotationFactor;
         protected Random Random;
         protected bool AddingAngle;
 
-        public StandardShip(Game newGame) : base(newGame) {}
+        public StandardShip(SuperPolarity newGame) : base(newGame) {}
 
         public override void  Initialize(Texture2D texture, Vector2 position)
         {
@@ -32,7 +33,7 @@ namespace SuperPolarity
             ChangeRate = 50;
             AngleChangeProbability = 50;
             BouncePadding = 0;
-            MaxVelocity = 1;
+            MaxVelocity = 2;
             CurrentTime = 0;
             RotationFactor = (float) (3 * Math.PI / 180);
             Random = new Random(BitConverter.ToInt32(cryptoResult, 0));
@@ -56,7 +57,18 @@ namespace SuperPolarity
             }
             ChangeAngle();
             Position += Velocity;
+            UpdateBox();
             Magnetizing = false;
+
+            if (Flashing)
+            {
+                Color = new Color(255, 255, 255, 128);
+                Flashing = false;
+            }
+            else
+            {
+                Color = Color.White;
+            }
         }
 
         protected void AutoMove()
@@ -110,5 +122,34 @@ namespace SuperPolarity
                 Velocity.Y = -Velocity.Y;
             }
         }
+
+        public override void Collide(Actor other, Rectangle collision)
+        {
+            if (Dying)
+            {
+                return;
+            }
+
+            if (other.GetType() == typeof(MainShip))
+            {
+                Die();
+                return;
+            }
+
+            if (other.GetType() == typeof(Bullet))
+            {
+                var theBullet = (Bullet)other;
+                TakeDamage(theBullet.Power);
+                Flashing = true;
+            }
+        }
+
+        protected override void Die()
+        {
+            ActorManager.CheckOut(this);
+            Renderer.CheckOut(this);
+            game.Player.AddScore(Value);
+            game.Player.AddMultiplier(1);
+        }
     }
 }